import 'package:intl/intl.dart';

class DateTimeUtil {
  static int weekNumber(DateTime date) {
    int dayOfYear = int.parse(DateFormat("D").format(date));
    return ((dayOfYear - date.weekday + 10) / 7).floor();
  }

  static String formatDate(DateTime dateTime,{String format='yyyyMMdd'}){
    DateFormat dateFormat = DateFormat(format);
    return dateFormat.format(dateTime);
  }

  static String formatTime(DateTime dateTime,{String format='HH:mm:ss'}){
    DateFormat dateFormat = DateFormat(format);
    return dateFormat.format(dateTime);
  }

  static String formatDateTime(DateTime dateTime,{String format='yyyy-MM-dd HH:mm:ss'}){
    DateFormat dateFormat = DateFormat(format);
    return dateFormat.format(dateTime);
  }

  static DateTime getDateTime(String dateTimeString){
    return DateTime.parse(dateTimeString);
  }


}
